package digg_api

import (
	"gin_study_blog/common"
	"gin_study_blog/common/http"
	"gin_study_blog/models"
	"gin_study_blog/service/redis"
	"github.com/gin-gonic/gin"
)

func (DiggApi) DiggArticleView(c *gin.Context) {
	var cr models.EsIDRequest
	err := c.ShouldBindJSON(&cr)
	if err != nil {
		http.FailWithCode(http.ParamsError, c)
		return
	}

	err = redis.NewDigg().Set(cr.ID)
	if err != nil {
		common.Log.Error(err)
		http.FailWithMessage("点赞错误", c)
		return
	}
	http.IsOkWithMessage("点赞成功", c)
}
